<?php


namespace dsp\chainOfResponsibility;


class Client
{
    public static function clientCode(Handler $handler)
    {
        foreach (["Nut", "Banana", "Cup of coffee"] as $food) {
            echo "Client: Who wants a " . $food . PHP_EOL;
            $result = $handler->handle($food);
            if ($result) {
                echo "  " . $result;
            } else {
                echo "  " . $food . " was left untouched." . PHP_EOL;
            }
        }
    }
}